//
//  UIViewController+Category.h
//  Paoword
//
//  Created by 欧杜书 on 16/5/25.
//  Copyright © 2016年 New. All rights reserved.
//

#import <UIKit/UIKit.h>


@protocol BackButtonHandlerProtocol <NSObject>
@optional
// Override this method in UIViewController derived class to handle 'Back' button click
- (BOOL)navigationShouldPopOnBackButton;
@end

typedef void(^navigationLeftItemCallback)(void);
@interface UIViewController (Category) <BackButtonHandlerProtocol>
@property (nonatomic , copy)navigationLeftItemCallback leftItemCallback;

+ (nullable UIViewController *)pw_currentViewController;
+ (nullable UIView *)pw_currentViewControllerView;

/**
 *  隐藏导航栏
 */
- (void)pw_setNavigationBarHidden;
/**
 *  隐藏导航栏（只有title）
 */
- (void)pw_setNavigationBarTransparentOnlyWithTitle:(NSString *)title tintColor:(UIColor *)tintColor;
/**
 *  隐藏导航栏（有返回按钮）
 */
- (void)pw_setNavigationBarTransparentWithTintColor:(UIColor *)tintColor;
/**
 *  隐藏导航栏（有返回按钮及title）
 */
- (void)pw_setNavigationBarTransparentWithTitle:(NSString *)title tintColor:(UIColor *)tintColor;
/**
 *  隐藏导航栏（有返回按钮及右边的items）
 */
- (void)pw_setNavigationBarTransparentWithRightBarButtonItems:(NSArray<UIBarButtonItem *> *)items tintColor:(UIColor *)tintColor;
/**
 *  隐藏导航栏（有返回按钮和title及右边的items）
 */
- (void)pw_setNavigationBarTransparentWithLeftItemImage:(NSString *)leftItemImage
                                                  title:(NSString *)title
                                    rightBarButtonItems:(NSArray<UIBarButtonItem *> *)items
                                              tintColor:(UIColor *)tintColor;
/**
 *  隐藏导航栏（无返回按钮及右边的items）
 */
- (void)pw_setNavigationBarTransparentWithoutLeftBarWithRightBarButtonItems:(NSArray<UIBarButtonItem *> *)items tintColor:(UIColor *)tintColor;

/**
 *  设置导航栏颜色
 */
//- (void)pw_setNavigationBarColor:(UIColor *)color tintColor:(UIColor *)tintColor;

// PresentCongtroller，弹出前判断 presentedViewController，避免弹出 Application tried to present modally an active controller
// 或者PresentCongtroller存在 判断类是否一样（避免重复present），不一样则调用PresentCongtroller 的 present 方法去展示，考虑到现在的UI层次 只做一层嵌套的判断
// 返回是否成功调用present
- (BOOL)pw_presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion;

@end
